#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int i = 0; int j = 0;
	int n = 0;
	while (scanf("%d", &n) != EOF)
	{
		for (i = 1; i <= n; i++)
		{
			if ((i == 1) || (i == n))
			{
				for (j = 1; j <= n; j++)
				{
					printf("* ");
				}
			}
			else
			{
				for (int k = 1; k <= n; k++)
				{
					if ((k == 1) || (k == n))
						printf("* ");
					else
						printf("  ");
				}
			}
			printf("\n");
		}
	}
	return 0;
}